#ifndef QGCM_STATIC_CONTAINER__
#define QGCM_STATIC_CONTAINER__

#include <vector>
#include "misclib.h"
#include "datatypes.h"
/*
 * =====================================================================================
 *
 *       Filename:  static.h

    Defines the static coefficients container class used to hold the static
    interaction coefficients. We do this with a class because the size may
    get large and we want rapid access sometimes and easy interface.
 *
 * =====================================================================================
 */
template <class T, int WIDTH>
class map_container {
  size_t size;
  T null_element;
  int lindex; // location of last looked up index
  rank<INDEX, WIDTH> * indexmap;
  T * coefficients;
  public: 
  map_container();
  private:
  map_container( map_container & ); // copy constructor
  public:
  
  void store_coefficients( const vector< rank<INDEX, WIDTH> > & imap, const vector<T> & data );
  void store_coefficients( const T * data, const rank<INDEX, WIDTH> * map, const int & size);

  bool does_element_exist(const rank<INDEX, WIDTH> &) const;
  const T & getvalue(const rank<INDEX, WIDTH> &) const;

  void storevaluediag( const rank<INDEX, WIDTH> &, const T &);

  const rank<INDEX,WIDTH> * get_index_map() const;
  const T * getcoefficients() const;
  const int get_size () const;

  ~map_container();
};

typedef map_container< qgcomplex, 11 > static_container;

#endif
